package rest.jbpm.wrappers.lists;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import rest.jbpm.wrappers.Execution;

@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
@XmlType(name = "executions", propOrder = {
    "executions"})
public class ExecutionList {

	private List<Execution> executions;
	private String baseUri;
	
	protected ExecutionList() {
		
	}
	
	public ExecutionList(Collection<? extends org.jbpm.api.Execution> execs, String baseUri) {
		
		this.baseUri = baseUri;
		executions = new ArrayList<Execution>();
		
		for(org.jbpm.api.Execution exe : execs)
			executions.add(new Execution(exe,baseUri));

	}
	
	@XmlElement(name="execution",required=true)
	public List<Execution> getExecutions() {
		return executions;
	}
}
